package com.pagoda.nerp.web.entities;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.pagoda.nerp.web.common.buildTree.TreeNode;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.*;
import javax.xml.bind.annotation.XmlRootElement;
import java.util.Date;

@Entity
@Data
@NoArgsConstructor
@AllArgsConstructor
@Table(name = "hrpost")
@XmlRootElement(name="hrorgpost")
public class HRORGPost implements TreeNode {
    @Id
    private String postid;

    private String jobtitlename;

    private String jobtitlecode;

    private String suppostid;

    private String deptcode;

    private String deptid;

    private String canonicalcode;
    @JsonIgnore
    private String canonicalparentcode;

    private Date modifytime;

    @Override
    public String toString() {
        return "HRORGPost{" +
                "postid='" + postid + '\'' +
                ", jobtitlename='" + jobtitlename + '\'' +
                ", jobtitlecode='" + jobtitlecode + '\'' +
                ", suppostid='" + suppostid + '\'' +
                ", deptcode='" + deptcode + '\'' +
                ", canonicalcode='" + canonicalcode + '\'' +
                ", canonicalparentcode='" + canonicalparentcode + '\'' +
                '}';
    }

    @Override
    @JsonIgnore
    public String getCode() {
        return this.canonicalcode;
    }

    @Override
    @JsonIgnore
    public String getParentCode() {
        return this.canonicalparentcode;
    }

    @Override
    @JsonIgnore
    public String getName() {
        return this.jobtitlename;
    }
}
